<template>
  <div>
    <el-container>
      <el-aside width="200px">
        <Asdie></Asdie>
        <el-divider content-position="left" direction="vertical">导航栏</el-divider>
      </el-aside>
      <el-container style="height: 100vh;">
        <el-header>
          <Header></Header>
        </el-header>
        <el-main style="padding-top: 0px;">
          <router-view></router-view>
        </el-main>
      </el-container>
    </el-container>

  </div>
</template>

<script>
import axios from 'axios'
import Asdie from '../components/aside.vue'
import Header from '../components/header.vue'
export default {
  data() {
    return {}
  },
  components: {
    Asdie,
    Header
  },
  methods: {},
  mounted() {
    // console.log(localStorage.getItem('login_admin'))
  },
  created() {
    if (localStorage.getItem('login_admin') === 'false') {
      this.$message.error('非法进入！')
      this.$router.replace({
        path: '/login'
      })
    }
  },
  beforeRouteEnter(to, from, next) {
    if (localStorage.getItem('login_admin') === 'false') {
      alert('警告')
      next()
    }
    next()
  }
}
</script>

<style lang="less" scoped>
.el-aside {
  justify-content: space-between;
  display: flex;
  height: 100vh;
}
.el-divider--vertical {
  margin: 0px;
  height: 100%;
}
</style>